home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C19 / Gromit.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  668 b   |  29 lines

  1. //: C19:Gromit.h
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // The techno-dog. Has member functions 
  7. // with various numbers of arguments.
  8. #include <iostream>
  9.  
  10. class Gromit { 
  11.   int arf;
  12. public:
  13.   Gromit(int arf = 1) : arf(arf + 1) {}
  14.   void speak(int) {
  15.     for(int i = 0; i < arf; i++)
  16.       std::cout << "arf! ";
  17.     std::cout << std::endl;
  18.   }
  19.   char eat(float) {
  20.     std::cout << "chomp!" << std::endl;
  21.     return 'z';
  22.   }
  23.   int sleep(char, double) {
  24.     std::cout << "zzz..." << std::endl;
  25.     return 0;
  26.   }
  27.   void sit(void) {}
  28. }; ///:~
  29.